package com.wf.day_0607.test2;

import java.io.IOException;
import java.io.PrintStream;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.Scanner;

/**
 * @author mpk
 * @since 2024/6/7 17:49:49
 */

//  作业2：PrintStream 通过控制台输入信息System.in，并存储进文本中
public class PrintStreamDemo {
    public static void main(String[] args) throws IOException {


        try (PrintStream printStream = new PrintStream(Files.newOutputStream(Paths.get("src/com/wf/day_0607/test2/test2.txt")), true)) {

            System.setOut(printStream);

            Scanner scanner = new Scanner(System.in);

            System.out.println(scanner.nextLine());


        }


    }


}
